/*
 *  objx.collect
 *	Collects the return values from a function called for each
 *	item in an array.
 *
 */
objx.requires("objx.each", "objx.collect");


objx.fn.collect = function( func ) {

	var output = [];
	if(typeof(func)=='string') 
	{
		this.each(function(item){
			output.push(item[func]);
		});
	} 
	else 
	{
		this.each(function(item){
			output.push(func.apply(this, [item]));
		});
	}
	
	return objx(output);

};

objx.provides("objx.collect");